package chen.web.controller;

import chen.web.MyContextProvider;
import chen.web.user.Account;
import chen.web.user.InternalRoleProvider;
import chen.web.user.NoPermissionException;

public class AdminRoleVerify {

	public static void verify(){
		if(!isAdmin()){
			throw new NoPermissionException();
		}
	}
	
	public static boolean isAdmin(){
		Account acc = MyContextProvider.getMyContext().getAccount();
		if(acc.getRole().equals(InternalRoleProvider.getAdminRole())){
			return true;
		}
		return false;
	}
}
